// pages/custom-tabbar/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    selected: 0, //选中状态
    color:"#000000",
    selectedColor: "#1E90FF",
    //tabbar列表
    list: [{
        "pagePath": "pages/home/home",
        "text": "首页",
        "iconPath": "/img/icon/shouye.png",
        "selectedIconPath": "/img/icon/shouye.png"
      },
      {
        "pagePath": "pages/travel/travel",
        "text": "游记",
        "iconPath": "/img/icon/youji.png",
        "selectedIconPath": "/img/icon/youji.png"
      },
      {
        "pagePath": "pages/fangyan/home/index",
        "text": "方言",
        "iconPath": "/img/icon/fangyan.png",
        "selectedIconPath": "/img/icon/fangyan.png"
      },
      {
        "pagePath": "pages/my/my",
        "text": "我的",
        "iconPath": "/img/icon/wode.png",
        "selectedIconPath": "/img/icon/wode.png"
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    // 获取可用区域宽高
    var that = this
    wx.getSystemInfo({
      success(res) {
        console.log(res.windowHeight)
        that.setData({
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        })
      }
    })
  },
  // tabbar切换页面按钮
  switchTab(e) {
    const data = e.currentTarget.dataset
    const url = data.path
    wx.switchTab({
      url:'/'+url
    })
    this.setData({
      selected: data.index
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})